<template>
  <button @click="inc">点我</button>
  <p>{{ count }}</p>
</template>

<script setup lang="ts">
const props = defineProps({
  // 注意这是只读的
  count: {
    type: Number,
    required: true
  }
});
const emit = defineEmits(["inc"]);

const inc = () => {
  console.log("child", props.count);
  emit("inc", Math.random());
};

const someFn = () => {
  console.log("defineExpose");
};
// 暴露给组件实例调用的属性方法
defineExpose({
  someFn,
  a: 3
});
</script>

<style></style>
